package org.ym.file.domain.model.node.enums;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 * @author ym
 */
@Converter
public class NodeInfoTypeConverter implements AttributeConverter<NodeInfoType,Integer> {
    @Override
    public Integer convertToDatabaseColumn(NodeInfoType attribute) {
        return attribute.getCode();
    }

    @Override
    public NodeInfoType convertToEntityAttribute(Integer dbData) {
        return NodeInfoType.of(dbData);
    }
}
